﻿


<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <title>CloudBOX | 锁屏</title>
      <link rel="shortcut icon" href="assets/images/logo_ico.png" type="img/png"/>
      <link rel="stylesheet" href="assets/css/backend.min.css">
      <link rel="stylesheet" href="assets/vendor/@fortawesome/fontawesome-free/css/all.min.css">
      <link rel="stylesheet" href="assets/vendor/line-awesome/dist/line-awesome/css/line-awesome.min.css">
      <link rel="stylesheet" href="assets/vendor/remixicon/fonts/remixicon.css">
      <link rel="stylesheet" href="assets/vendor/doc-viewer/include/pdf/pdf.viewer.css">
      <link rel="stylesheet" href="assets/vendor/doc-viewer/include/PPTXjs/css/pptxjs.css">
      <link rel="stylesheet" href="assets/vendor/doc-viewer/include/PPTXjs/css/nv.d3.min.css">
      <link rel="stylesheet" href="assets/vendor/doc-viewer/include/SheetJS/handsontable.full.min.css">
      <link rel="stylesheet" href="assets/vendor/doc-viewer/include/verySimpleImageViewer/css/jquery.verySimpleImageViewer.css">
      <link rel="stylesheet" href="assets/vendor/doc-viewer/include/officeToHtml/officeToHtml.css">
      <link rel="stylesheet" href="assets/vendor/notice/css/bs4.pop.css">
  </head>
  <body class=" ">

    <div id="loading">
          <div id="loading-center">
          </div>
    </div>
    
      <div class="wrapper">
      <section class="login-content">
         <div class="container h-100">
            <div class="row justify-content-center align-items-center height-self-center">
               <div class="col-md-5 col-sm-12 col-12 align-self-center">
                  <div class="sign-user_card">
                        <img src="assets/images/logo.png" class="img-fluid rounded-normal light-logo logo" alt="logo">
                        <img src="assets/images/logo-white.png" class="img-fluid rounded-normal darkmode-logo logo" alt="logo">
                     <h3 class="mb-3">欢迎回来!</h3>
                     <p id="note"></p>
                     <form>
                        <div class="row">
                           <div class="col-lg-12">
                              <div class="floating-label form-group">
                                 <input class="floating-input form-control" id="password" type="password" placeholder=" ">
                                 <label>密码</label>
                              </div>
                           </div>
                        </div>
                        <button type="button" id="login" class="btn btn-primary">登录</button>
                     </form>
                  </div>
               </div>
            </div>
         </div>
      </section>
      </div>
    
    <script src="assets/js/jquery-1.8.3.min.js"></script>
    <script src="assets/js/backend-bundle.min.js"></script>
    <script src="assets/js/customizer.js"></script>
    <script src="assets/js/chart-custom.js"></script>
    <script src="assets/vendor/doc-viewer/include/pdf/pdf.js"></script>
    <script src="assets/vendor/doc-viewer/include/docx/jszip-utils.js"></script>
    <script src="assets/vendor/doc-viewer/include/docx/mammoth.browser.min.js"></script>
    <script src="assets/vendor/doc-viewer/include/PPTXjs/js/filereader.js"></script>
    <script src="assets/vendor/doc-viewer/include/PPTXjs/js/d3.min.js"></script>
    <script src="assets/vendor/doc-viewer/include/PPTXjs/js/nv.d3.min.js"></script>
    <script src="assets/vendor/doc-viewer/include/PPTXjs/js/pptxjs.js"></script>
    <script src="assets/vendor/doc-viewer/include/PPTXjs/js/divs2slides.js"></script>
    <script src="assets/vendor/doc-viewer/include/SheetJS/handsontable.full.min.js"></script>
    <script src="assets/vendor/doc-viewer/include/SheetJS/xlsx.full.min.js"></script>
    <script src="assets/vendor/doc-viewer/include/verySimpleImageViewer/js/jquery.verySimpleImageViewer.js"></script>
    <script src="assets/vendor/doc-viewer/include/officeToHtml/officeToHtml.js"></script>
    <script src="assets/js/doc-viewer.js"></script>
    <script src="assets/js/app.js"></script>
    <script src="assets/vendor/notice/js/bs4.pop.js"></script>
    <script src="assets/vendor/notice/bootstrap-4.0.0-dist/js/bootstrap.min.js"></script>
    <script type="text/javascript">

        //锁屏
        block();

        /**
         * 锁屏
         */
        function block() {
            $.ajax({
                url:'cloud-user/keep',
                type:'post',
                dataType: 'json',
                success:function (result) {
                    console.info("锁屏成功.")
                }
            });
        };

        /**
         * 解屏
         */
        $("#login").click(function () {

            let password = $("#password").val();

            if (password == null || password == '') {
                bs4pop.notice('请输入账号密码！', {type: 'danger'});
                return;
            }


            $.ajax({
                url: 'cloud-user/welcome',
                type: 'get',
                dataType: 'json',
                success:function (result) {
                    if (result.code == 200) {
                        let user = result.data;
                        var username = user.username;

                        $.ajax({
                            url: 'cloud-user/login',
                            type: 'post',
                            data: {
                                username: username,
                                password: $("#password").val()
                            },
                            dataType: 'json',
                            success:function (result) {
                                if (result.code == 200) {
                                    location.href= "page-index.html";
                                }else {
                                    $("#password").val("");
                                    bs4pop.notice('密码输入错误！', {type: 'danger'});
                                }
                            }
                        });

                    }
                }
            });




        });

        /**
         * 定时存活session
         */
        setInterval(function () {
            $.ajax({
                url:'cloud-user/keep',
                type:'post',
                dataType: 'json',
                success:function (result) {
                    console.info("会话成功！")
                }
            });
        }, 60000)

        /**
         * 锁屏语
         * @type {string[]}
         */
        var demo = [
            '我与春风皆过客，你携秋水揽星河.',
            '愿有岁月可回首，且以深情共白头.',
            '三生有幸遇见你，纵使悲凉也是情.',
            '即许一人一偏爱，愿尽余生之慷慨.',
            '愿往后余生，冷暖有相知，喜乐有分享.',
            '同量天地宽，共度日月长.'
        ];

        var i = 0;
        $("#note").html("人潮汹涌，感谢遇见你.");
        setInterval(function () {
            $("#note").fadeOut(3000);
            $("#note").html(demo[i]);
            $("#note").fadeIn(3000);
            i = i + 1;
            if (i == demo.length) {
                i = 0;
            }
        }, 6000)

    </script>
  </body>
</html>